﻿using Microsoft.AspNetCore.Builder;
using MyWeb.Common.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyWeb.Extensions.ServiceExtensions.Authorization
{
    /// <summary>
    /// 授权管理中间键
    /// </summary>
    public static class AuthorizationMiddleware
    {
        public static void UseAuthorizationMiddle(this IApplicationBuilder app)
        {
            if (app == null) throw new ArgumentNullException(nameof(app));

            //是否启用Ids4
            if (AppSettings.app(new string[] { "Startup", "IdentityServer4", "Enabled" }).ObjToBool())
            {
                //app.UseAuthentication();
            }

            app.UseAuthorization();
        }
    }
}
